import {removeCookies} from "util/auth";

require('./index.css');
import _tool from  'util/tool';
import _mm from 'util/mm.js';
import _all from 'service/all-service';
const page = {
    init() {
        this.bindEvent();
        this.loadDropList();
    },
    loadDropList() {
        _all.getIndexAllType(res => {
            const page = require('./topHeadDrop.string');
            const html = _mm.renderHtml(page, {data: res.data});
            $('.in-right').html(html);
        })
    },
    bindEvent() {
        const _this = this;
        const addNode = function () {
            const $this = $(this);
            _tool.pushNode($this);
        };
        const clear = function () {
            // debugger
            removeCookies('bmenu');
        };
        $(document).on('click', 'li>a', addNode);
        $('.go-index').on('click', clear);
    }
};

module.export = page.init();